*******************************************************
* Lyle 05 Jan 11: 						              *
*	-this program serves as a base shell for all	  *
*	 stata do files					                  *
*******************************************************

* do c:/users/Jordan.Becker/Desktop/GD/20131028PubOpStratCult/do/PubOpStratCult.do*

********************************
* Standard Stata Configuration *
********************************
clear all
set mem 999m
capture log close
set logtype text
cap cd "C:\Users\ejm5\Google Drive\2016_Research\Unemployment_MILEX"
cap cd "C:\Users\Jordan.Becker\Desktop\GD\2016_Research\Unemployment_MILEX"
cap cd "\\usnatonetapp01.eur.state.sbu\profiles\beckerjm\Desktop\2016_Research\Unemployment_MILEX"
log using "log\correlates_table6.log", replace


*********************
* Prepare Variables *
*********************
use "dta\2016_02_09_uem", clear
sort ccode year
xtset ccode year

********************
* Analyze the Data *
********************
set more off
sort ccode year
xtset ccode year


*TABLE 1: IV Analysis of Free-Riding on U.S.*
#delimit;
xtset ccode year;
xi:xtpcse milburden_lastfive l.ln_usa_milex_fyma i.ccode if ccode!=2, pairwise;
outreg2 using output\Correlates_Table6, bdec(3) tdec(3) e(rmse) replace;
xi:xtpcse milburden_lastfive l.ln_usa_milex_fyma i.ccode if nato_year_dummy==1&ccode!=2, pairwise;
outreg2 using output\Correlates_Table6, bdec(3) tdec(3) e(rmse);
xi:xtreg ln_usa_milex_fyma usa_war_infrastructure_lastfive i.ccode if ccode!=2, robust cluster(ccode);
outreg2 using output\Correlates_Table6, bdec(3) tdec(3) e(rmse);
xi:xtivreg2 milburden_lastfive (l.ln_usa_milex_fyma=l.usa_war_infrastructure_lastfive) if ccode!=2, first fe robust cluster(ccode);
outreg2 using output\Correlates_Table6, bdec(3) tdec(3) e(rmse);
xi:xtivreg2 milburden_lastfive (l.ln_usa_milex_fyma=l.usa_war_infrastructure_lastfive) if  nato_year_dummy==1&ccode!=2, first fe robust 
cluster(ccode);
outreg2 using output\Correlates_Table6, bdec(3) tdec(3) e(rmse);

*Norway vs. Sweden Free-Riding*
#delimit;
ivreg2 milburden_lastfive (l.ln_usa_milex_fyma=l.usa_war_infrastructure_lastfive) if countryname=="Denmark", first;
outreg2 using output\Correlates_Table6, bdec(3) tdec(3) e(rmse);
ivreg2 milburden_lastfive (l.ln_usa_milex_fyma=l.usa_war_infrastructure_lastfive) if countryname=="Norway", first;
outreg2 using output\Correlates_Table6, bdec(3) tdec(3) e(rmse);
ivreg2 milburden_lastfive (l.ln_usa_milex_fyma=l.usa_war_infrastructure_lastfive) if countryname=="Finland", first;
outreg2 using output\Correlates_Table6, bdec(3) tdec(3) e(rmse);
ivreg2 milburden_lastfive (l.ln_usa_milex_fyma=l.usa_war_infrastructure_lastfive) if countryname=="Sweden", first;
outreg2 using output\Correlates_Table6, bdec(3) tdec(3) e(rmse) excel;


